package com.ipcoder;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IpCoder {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress computer = InetAddress.getByName("nddwm");
        //获取电脑的IP的
        String ip = computer.getHostAddress();
        //获取电脑的名称的
        String name = computer.getHostName();
        System.out.println("此电脑的地址是:" + ip);
        System.out.println("此电脑的名称是:" + name);


    }
}
